package com.example.demo.vo

import com.example.demo.dbmodels.TBed
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import java.time.LocalDateTime


@ApiModel(description = "床头卡信息")
class BedVo {

    /**
     *  床位id
     **/
    var id: Int? = null
    /**
     *  病区编号
     **/
    var district_code: String? = null
    /**
     *  科室编号
     **/
    var dept_code: String? = null
    /**
     *  床位编号
     **/
    var bed_code: String? = null
    /**
     *  床位名称
     **/
    var bed_name: String? = null
    /**
     *  床位名称
     **/
    var bed_name2: String? = null
    /**
     *  床头卡id
     **/
    var bed_card_id: Int?= null
    /**
     *  病房ID
     **/
    var room_code: String? = null
    /**
     *  床位类型
     **/
    var bed_type: String? = null
    /**
     *  病人ID
     **/
    var patient_id: Int?= null
    /**
     *  床位占用状态：0空闲 1使用
     **/
    var status: Int?= null
    /**
     *  备注
     **/
    var remark: String? = null
    /**
     *  条码
     **/
    var barcode: String? = null
    /**
     *  更新时间
     **/
    var update_time: LocalDateTime?= null
    /**
     *  更新人
     **/
    var update_by: Int?= null
    /**
     *  删除标记
     **/
    var is_del: Boolean? = null



    fun getVo(table: TBed): BedVo {
         table.let {
            val data = BedVo()
            data.id = it.id
             data.barcode = it.barcode
             data.bed_card_id = it.bed_card_id
             data.bed_code = it.bed_code
             data.bed_name = it.bed_name
             data.bed_name2 = it.bed_name2
             data.bed_type = it.bed_type
             data.dept_code = it.dept_code
             data.district_code = it.district_code
             data.is_del = it.is_del
             data.patient_id = it.patient_id
             data.remark = it.remark
             data.room_code = it.room_code
             data.status = it.status
             data.update_by = it.update_by
             data.update_time = it.update_time
            return data
        }
    }

    fun getListVo(table: List<TBed>): List<BedVo> {
        table.let {
            val deptVos = mutableListOf<BedVo>()
            table.forEach {
                val data = BedVo()
                data.id = it.id
                data.barcode = it.barcode
                data.bed_card_id = it.bed_card_id
                data.bed_code = it.bed_code
                data.bed_name = it.bed_name
                data.bed_name2 = it.bed_name2
                data.bed_type = it.bed_type
                data.dept_code = it.dept_code
                data.district_code = it.district_code
                data.is_del = it.is_del
                data.patient_id = it.patient_id
                data.remark = it.remark
                data.room_code = it.room_code
                data.status = it.status
                data.update_by = it.update_by
                data.update_time = it.update_time
                deptVos.add(data)
            }
            return deptVos
        }
    }

}
